package org.example.controller;

import com.baomidou.dynamic.datasource.annotation.DS;
import org.example.domain.Car;
import org.example.domain.TAddr;
import org.example.service.CarService;
import org.example.service.TAddrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("car")
public class CarController {
    @Autowired
    private CarService carService;
    @Autowired
    private TAddrService addrService;

    @RequestMapping("list")
    public List<List<Double>> list() {
        List<List<Double>> lineArr=new ArrayList<>();
        List<Car> list = carService.list();
        for (Car car : list) {
            lineArr.add(Arrays.asList(car.getCarLongitude(),car.getCarLatitude()));
        }
        System.out.println(lineArr+"---------------TDengine");
        List<TAddr> list1 = addrService.list();
        System.out.println(list1+"-----------------mysql");
        return lineArr;
    }
}
